function articletype_form_submit() {
	$.ajax({
		cache : !1,
		type : "POST",
		url : "/grt/article/saveArticleType",
		data : $("#articletype_form").serialize(),// 使用该方法提交属性form表单中的属性,要提交的元素要增加name属性，否则无法被提交
		success : function(data) {
			var result;// 多加个判断，这里有个奇葩的bug，同样的代码，有时候data为对象有时候为字符串
			if (typeof (data) == String) {
				result = JSON.parse(data);
			} else {
				result = data;
			}

			if (result.successed == true) {
				$("#save-form-tips").html("添加成功").show(1500)
				var url = "/grt/article/articleTypeList";
				location.href = url;
			} else {
				$("#save-form-tips").html("添加失败，请稍后重试！" + result.msg).show(500)
			}
		}
	})
}

function getcaselist(pageindex, pagesize) {
	$.ajax({
		cache : !1,
		type : "GET",
		url : "/grt/admin/getCaseList?pageindex=" + pageindex + "&pagesize="
				+ pagesize,
		success : function(data) {
			var result;// 多加个判断，这里有个奇葩的bug，同样的代码，有时候data为对象有时候为字符串
			if (typeof (data) == String) {
				result = JSON.parse(data);
			} else {
				result = data;
			}
			// 根据result构建tbody内容
			var html = "";
			var datas = result.datas;
			for (var i = 0; i < datas.length; i++) {
				html += "<tr>";

				var obj = datas[i];
				var sid = "<td>" + obj.id + "</td>";
				html += sid;
				var sname = "<td>" + obj.casename + "</td>";
				html += sname;
				var sdesc = "<td>" + obj.casedesc + "</td>";
				html += sdesc;
				var slink = "<td>" + obj.caselink + "</td>";
				html += slink;
				var simg = "<td>" + obj.caseimg + "</td>";
				html += simg;
				var stype = "<td>" + obj.type + "</td>";
				html += stype;
				var soper = "<td><a href=\"updateCase?id=" + obj.id
						+ "\">编辑</a>|<a onclick=\"javascript:deletecase("
						+ obj.id + ");\">删除</a></td>";
				html += soper;

				html += "</tr>";
			}
			$("#datas").html(html);
		}
	})
}

function deletecase(id) {
	$.ajax({
		cache : !1,
		type : "GET",
		url : "/grt/admin/deleteCase?id=" + id,
		success : function(data) {
			var result;// 多加个判断，这里有个奇葩的bug，同样的代码，有时候data为对象有时候为字符串
			if (typeof (data) == String) {
				result = JSON.parse(data);
			} else {
				result = data;
			}

			if (result.successed == true) {
				var url = "/grt/admin/caselist";
				alert(result.msg);
				location.href = url;
			} else {
				alert(result.msg);
			}
		}
	})
}

function type_edit(id){
	alert(id);
}

//$(function() {
//	$("#type_edit").click()
//	{
//		//alert('aaaa');
//	}
//});